#!/bin/sh
sysName=$1
confDir=/srv/salt/prod/nginx/files/nginx-config-dir/vhosts_net

sed -i "s/proxy_pass.*${sysName}.*;/proxy_pass http:\/\/${sysName}_main;/g" $confDir/${sysName}.conf

salt -N 'ngxonline' state.highstate
salt -N 'ngxonline' cmd.run 'nginx -t'
salt -N 'ngxonline' cmd.run 'nginx -s reload'
